SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO



CREATE PROCEDURE [dbo].[usp_SearchAdmin]
    (
      @fdAdminLoginID VARCHAR(50),
      @fdAdminName VARCHAR(50),
      @fdAdminStatus BIT--从单选框选择，不会为空
    )
AS --IF @fdAdminLoginID = ''
    --    AND (
    --          NOT ( @fdAdminName = '' )
    --        ) 
    --    SELECT  fdAdminLoginID,
				--fdAdminPwd,
    --            fdAdminName,
    --            fdAdminMobile,
    --            fdAdminEmail,
    --            fdAdminPhone,
    --            fdAdminStatus
    --    FROM    dbo.JOL_Admin
    --    WHERE   ( fdAdminName LIKE '%' + @fdAdminName + '%' )
    --            AND fdAdminStatus = @fdAdminStatus
    --            ORDER BY fdAdminLoginID
    --IF (
    --     NOT ( @fdAdminLoginID = '' )
    --   )
    --    AND @fdAdminName = '' 
    --    SELECT  fdAdminLoginID,
				--fdAdminPwd,
    --            fdAdminName,
    --            fdAdminMobile,
    --            fdAdminEmail,
    --            fdAdminPhone,
    --            fdAdminStatus
    --    FROM    dbo.JOL_Admin
    --    WHERE   ( fdAdminLoginID LIKE '%' + @fdAdminLoginID + '%' )
    --            AND fdAdminStatus = @fdAdminStatus
    --            ORDER BY fdAdminLoginID
    --IF (
    --     NOT ( @fdAdminName = '' )
    --   )
    --    AND (
    --          NOT ( @fdAdminLoginID = '' )
    --        ) 
    --    SELECT  fdAdminLoginID,
				--fdAdminPwd,
    --            fdAdminName,
    --            fdAdminMobile,
    --            fdAdminEmail,
    --            fdAdminPhone,
    --            fdAdminStatus
    --    FROM    dbo.JOL_Admin
    --    WHERE   ( fdAdminLoginID LIKE '%' + @fdAdminLoginID + '%' )
    --            AND ( fdAdminName LIKE '%' + @fdAdminName + '%' )
    --            AND ( fdAdminStatus = @fdAdminStatus )
    --            ORDER BY fdAdminLoginID
    --IF @fdAdminLoginID = ''
    --    AND @fdAdminName = '' 
    --    SELECT  fdAdminLoginID,
				--fdAdminPwd,
    --            fdAdminName,
    --            fdAdminMobile,
    --            fdAdminEmail,
    --            fdAdminPhone,
    --            fdAdminStatus
    --    FROM    dbo.JOL_Admin
    --    WHERE   fdAdminStatus = @fdAdminStatus
    SELECT  fdAdminLoginID,
            --fdAdminPwd,
            fdAdminName,
            fdAdminMobile,
            fdAdminEmail,
            fdAdminPhone,
            fdAdminStatus
    FROM    dbo.JOL_Admin
    WHERE   ( fdAdminLoginID LIKE '%' + @fdAdminLoginID + '%' )
            AND ( fdAdminName LIKE '%' + @fdAdminName + '%' )
            AND fdAdminStatus = @fdAdminStatus
    ORDER BY fdAdminLoginID



GO
